package com.feisuanyz.controller;

import com.feisuanyz.dto.PermissionCheckQuery;
import com.feisuanyz.service.UserPermissionService;
import com.feisuanyz.vo.RestResult;
import jakarta.validation.Valid;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * 用户权限Controller类
 */
@Slf4j
@RestController
@RequestMapping("/permissions")
public class UserPermissionController {

    @Autowired
    private UserPermissionService userPermissionService;

    @PostMapping("/check")
    public RestResult checkPermission(@Valid @RequestBody PermissionCheckQuery query) {
        log.info("权限检查请求: {}", query);
        return userPermissionService.checkPermission(query);
    }
}